<%@ page language="java" contentType="text/html; charset=UTF-8"
	import="com.zmht.specedu.vo.Teachbook,com.zmht.specedu.vo.Soundstudy,java.util.*"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	/**
	 * @author 谭湘元
	 * @since 2009/05/21
	 */

 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030" />
<title>聋校语言学习及矫治系统</title>
<fmt:setBundle basename="PathResource" scope="session" />
<link href="<%=request.getContextPath() %>/<fmt:message key='StylePath' />style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="<fmt:message key='datePicker' />WdatePicker.js"></script>
	<script type="text/javascript">
	function submitForm1(){
		if(document.forms[0].name.value==""){
			alert("游戏名称必须填写！");
			document.forms[0].name.focus();
			return;
		}
		if(document.forms[0].gameType.value==""){
			alert("游戏类别必须选择！");
			document.forms[0].gameType.focus();
			return;
		}
		if(document.forms[0].gameFile.value==""){
			alert("游戏文件必须选择！");
			document.forms[0].gameFile.focus();
			return;
		}
		var inputs = document.getElementsByTagName("input");
		for(var i=0;i<inputs.length;i++){
			if(inputs[i].type=="file"){
				var value = inputs[i].value;
				if(value==""){
					continue;
				}
				var accept = inputs[i].accept;
				if(accept=="" || accept=="undefine"){
					continue;
				}
				
				var endwith = value.substring(value.lastIndexOf(".")+1);
				if(accept.toLowerCase().indexOf(endwith)< 0){
					var message = inputs[i].message;
					if(message){
						alert(message+" 必须以"+accept+"结尾!");
					}else{
						alert("所选文件必须以"+accept+"结尾!");
					}
					inputs[i].focus();
					return;
				}
			}
		}
		var remark = document.forms[0].remark.value;
		if(remark.length>100){
			alert("描述最多只能输入100个字！");
			document.forms[0].remark.select();
			return;
		}
		document.forms[0].submit();
	}
		
		window.onload = function(){
			var successFlag = "<c:out value="${addTeachBookSuccess}" />"
			if(successFlag!="")
				alert(successFlag);
		}
		function addNewWord(e,obj){
			if(obj.value.length>100){
				e.returnValue = false;
			}
		}
	</script>
	
</head>

<body class="bcolor">
<form action="game.do?method=createGame" method="post" enctype="multipart/form-data" name="teachBookForm" id="form1">
  <table cellspacing="0" cellpadding="0" width="99%" align="center" border="0">
	<tbody>
	<tr>
        <td width="7"><img height="38" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_01.gif" width="7" /></td>
        <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_05.gif"><table cellspacing="0" cellpadding="0" width="100%" border="0">
            <tbody>
              <tr>
                <td width="30"><img height="38" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_02.gif" width="30" /></td>
                <td align="left" width="200" background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_03.gif">&nbsp;<strong>增 加 游 戏</strong></td>
                <td width="59"><img height="38" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_04.gif" width="59" /></td>
                <td>&nbsp;</td>
              </tr>
            </tbody>
        </table></td>
        <td width="8"><img height="38" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_06.gif" width="8" /></td>
    </tr>
    <tr>
		<td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_07.gif"><img height="1" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />spacer.gif" width="1" /></td>
        <td bgcolor="#f7fbff">
      <table cellspacing="0" bordercolordark="#ccccff" cellpadding="0" width="100%" bordercolorlight="#ffffff" border="0">
	  	<tbody>
          <tr>
            <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                <tr>
                  <td width="15%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">游戏名称：</td>
                  <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="name" type="text" class="boxcopy2" id="textfield10" maxlength="20" style="width:295px;"/>
                      <span class="STYLE4">*</span></td>
                </tr>
            </table></td>
          </tr>
          
          <tr>
            <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                <tr>
                  <td width="15%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">游戏类别：</td>
                  <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
					<select name="gameType" class="boxcopy2" id="select5" style="width:300px;">
						<c:forEach items="${gameTypes}" var="gameType" varStatus="status">
							<option value="<c:out value="${gameType.id}" />" <c:if test="${status.index==0}">selected</c:if>>
								<c:out value="${gameType.name}"></c:out>
							</option>
						</c:forEach>
                  	</select></td>
                </tr>
            </table></td>
          </tr>
          
          <tr>
            <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                <tr>
                  <td width="15%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">游戏介绍：</td>
                  <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><textarea name="remark" rows="5" class="boxcopy2" id="textfield30" onpropertychange="if(value.length>100) value=value.substr(0,100)" style="width:295px;"></textarea> 最多可输入100个字符</td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                <tr>
                  <td width="15%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">游戏文件(*.swf)：</td>
                  <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
					<input name="gameFile" type="file" contentEditable="false" class="boxcopy2" id="fileField" style="width:300px;" message="游戏文件" accept="swf" />  <span class="STYLE4">*</span>
				  </td>
                </tr>
            </table></td>
          </tr>
          
			</tbody>
        </table>
        <table cellspacing="1" cellpadding="0" width="100%" bgcolor="#ffffff" border="0">
           <tbody>
                <tr>
                  <td valign="middle" bgcolor="#e6f0f8"><table cellspacing="0" cellpadding="3" width="100%" border="0">
                      <tbody>
			            <tr>
			              <td width="50%" height="20" align="right"><a href="javascript:submitForm1();" onfocus="this.blur()"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />gif-01.gif" border="0" /></a>&nbsp;</td>
			              <td height="20" align="left">&nbsp;<a href="javascript:document.forms[0].reset();" onfocus="this.blur()"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />gif-02.gif" border="0" /></a></td>
			            </tr>
       				 </tbody>
                  </table></td>
                </tr>
           </tbody>
        </table>
		</td>
		<td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_09.gif"><img height="1" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />spacer.gif" width="1" /></td>
    </tr>
    <tr>
        <td><img height="22" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_10.gif" width="7" /></td>
        <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_11.gif">&nbsp;</td>
        <td><img height="22" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_12.gif" width="8" /></td>
      </tr>
	</tbody>
  </table>
</form>
</body>
</html>
